package salary

import "reflect"

type SalesReceiptTransaction struct {
	EmployeeId   int
	SalesReceipt SalesReceipt
}

func GetSalesReceiptTransaction(employeeId int, salesReceipt SalesReceipt) *SalesReceiptTransaction {
	return &SalesReceiptTransaction{EmployeeId: employeeId, SalesReceipt: salesReceipt}
}

func (s *SalesReceiptTransaction) Execute() {
	e := GetDB().GetEmployee(s.EmployeeId)
	classification := e.PaymentClassification
	ct := reflect.TypeOf(classification)
	cot := reflect.TypeOf(CommissionedClassification{})
	if ct != cot {
		panic("关联失败，雇员不是带薪雇员")
	}
	//append(classification.GetSalesReceipts(), s.SalesReceipt)
}
